package com.jt.demo24;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@org.aspectj.lang.annotation.Aspect
public class Aspect {

    @Pointcut("bean(userImpl)")
    public void pointCut(){
    }

    @Around("pointCut()")
    public Object aff(ProceedingJoinPoint point) throws Throwable {
        long l = System.currentTimeMillis();
        System.out.println("环绕1");
        Object proceed = point.proceed();
        System.out.println("环绕1");
         long l1=System.currentTimeMillis();
        System.out.println(l1-l);
        return "dd";
    }

    @AfterThrowing(value = "pointCut()",throwing = "exception")
    public void agg(Exception exception){
        System.out.println(exception.getMessage());
       //return exception.getLocalizedMessage();
    }
}
